<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../style/ucs.css">
    <link rel="stylesheet" href="../content/font/iconfont.css">
    <link rel="stylesheet" href="../style/theme.css">
</head>
<body>
    <div id="giraffe"></div>
    <script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
    <script type="text/javascript" src="../../dist/libs/engine.js"></script>
    <script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>

    <script type="text/javascript">
        //支付方式模型
        var payTypeDM = new UDM({
            value : 2,//1代表快捷支付 2代表网关支付
            onClick: function(){
                console.log(payTypeDM.getValue());
            }
        });
        //确认投资金额
        var inputNumDM = new UDM({
            value:{
                "FinanceDetail":
                {
                    "FinancingId":"00ccff26-9343-40ef-b3da-9bf92068349e",
                    "ProjectName":"乐盈【201608110021】",
                    "PrjectType":0,
                    "IsExclusivePublic":false,
                    "ProjectStatus":5,
                    "Duration":95,
                    "Interest":8.60,
                    "MinInvestPartsCount":0,
                    "MaxInvestPartsCount":10000,
                    "RemainPartsCount":0,
                    "EachPartAmount":1.00,
                    "AppendBuyAmount":1000.00,
                    "RepayBegin":"2016-11-30 00:00:00",
                    "MaxLimitCount":20000.00,
                    "TotalMaxLimitCount":500000.00,
                    "ReFree":"13608040001",
                    "PartsCount":0
                },
                "Status":1
            }
        });

        var BankCardListDM = new UDM({
            value: {
                BankCardId:"",
                BankCardList: [
                    {
                        "BankName": "",
                        "BankCode": "",
                        "BankLogo": "",
                        "Brdnbr": "",
                        "SingleLimit": "",
                        "DailyLimit": "",
                        "Type": "",
                        "Description": ""
                    }
                ]
            }
        });

        //回款账户
        var PayBankCardsDM = new UDM({
            value:{
                Status:1,       //绑卡状态 0：失败，1：成功，2：未绑卡
                PrjectType:1,        //0：普通项目，1：专属项目
                SelectIndex:1,      //默认选中的银行卡
                StayMobile:"186****2323",
                BankCardId:"",
                BankAccountList:[
                    {
                        "UserBankAccountId": "",
                        "AccountNoHide": " ",
                        "AccountNoShortHide": "",
                        "AccountName": "",
                        "BankCardLogo": "",
                        "BankCardType": 0,
                        "BankCode": "",
                        "BankIconCss": "",
                        "BankIconUrl": "",
                        "BankName": "",
                        "Brdnbr": null,
                        "Type": "",
                        "SingleLimit": 10,
                        "DailyLimit": 100,
                        "Description": ""
                    }
                ]
            }
        });
        //身份信息
        var userInfoDM = new UDM({
            value:{
                realName:"黎**",
                IDcard:"441111*******02",
                StayMobile:{
                    value:111,
                    className:"222"
                }
            }
        });
        //专属码
        var ExclusiveNumDM = new UDM({
            placeholder:"请输入项目专属识别码",
            validator:[
                {type:"require",msg:"该项目为专属项目，请输入项目专属识别码"}
            ]
        });
        //支付密码
        var BussinessPwdDM = new UDM({
            placeholder:"请输入支付密码",
            validator:[
                {type:"require",msg:"支付密码不能为空"}
            ]
        });
        //推荐码
        var ReFreeDM = new UDM({
            placeholder:"请输入推荐码",
            validator:[
                {
                    type:"fn",
                    fn:function(v){
                        console.log(v)
                    },
                    msg:"推荐码不存在，请重新输入"
                }
            ]
        });
        //同意协议
        var checkboxDM = new UDM({
            value:true,
            onClick:function(v){
                console.log(v)
            }
        });
        //确认购买按钮
        var btnDM = new UDM({
            onClick:function(){
                console.log('快捷支付选中银行卡id：'+PayBankCardsDM.getValue().BankCardId);  //快捷支付选中银行卡id
                console.log('网关支付选中银行卡Id：'+BankCardListDM.getValue().BankCardId);  //网关支付选中银行卡Id
                console.log(checkboxDM.getValue())
                if(payTypeDM.getValue()==1){
                    var result = {
                        orderType:1,
                        ProjectName:"企贷项目【20160503】",
                        OrderAmount:10000.00,
                        InterestAmount:3.12,
                        Interest:5000.00,
                        Duration:30,
                        RepayBegin:"2016-10-06",
                        ErrorTips:"对不起，该订单交易处理失败，请您稍后再试或者咨询：0816-2373017",
                        retry:function () {
                            UEventHub.emit('showResult',false);
                        }
                    };
                    PageDM.resultDate.setValue(result);
                    UEventHub.emit('showResult',true,result);
                }else{
                    var result = {
                        formHtml: "<form action='http://www.baidu.com' target='_blank' id='instaPay'></form>",
                        formId: "instaPay",
                        reOrderUrl: "http://www.baidu.com",
                        checkPay: function(){
                            console.log(123);
                        },
                        msg: ""
                    }
                    PageDM.gatewayResult.setValue(result);
                    UEventHub.emit('gatewayPay',result);
                }
            }
        });
        //收益计算公式 360天
        var daysDM = new UDM({
            value:360
        });
        var URLDM = new UDM({
            value:{
                home:"../Index/index.html",     //首页
                account:"../MyAccount/index.html", //账户中心
                invest:"../InvestList/index.html",  //我要投资
                addCard:"../MyBankCard/index.html", //添加银行卡
                agreement:{
                    name:"",
                    link:"",
                    onClick:function () {
                        setTimeout(function () {
                            console.log(11111)
                            window.open(URLDM.value.agreement.link);
                        },2000);
                    }
                },//协议链接
                retry:"../ConfirmPay/index.html"    //返回重试
            }
        });
        var resultDateDM = new UDM({
            value:{
                orderType:-1,
                ProjectName:"企贷项目【20160503】",
                OrderAmount:100000.00,
                Interest:5000.00,
                Duration:30,
                InterestAmount:"5600.35",
                RepayBegin:"2016-10-06",
                ErrorTips:"对不起，该订单交易处理失败，请您稍后再试或者咨询：0816-2373017",
                retry:function () {
                    UEventHub.emit('showResult',false)
                }
            }
        });
        var gatewayResultDM = new UDM({
            value: {
                formHtml: "",
                formId: "",
                reOrderUrl: "",
                msg: "",
                checkPay: function(){
                    console.log(123);
                }
            }
        });
        var gatewayLayerDM = new Dialog({
            closeBack:function () {
                gatewayLayerDM.hideDialog();
                BussinessPwdDM.reset();
            }
        });
        var ajaxFn = function(){
            //确认投资金额
            inputNumDM.setValue({
                "FinanceDetail":
                {
                    "FinancingId":"00ccff26-9343-40ef-b3da-9bf92068349e",
                    "ProjectName":"乐盈【201608110021】",
                    "PrjectType":0,
                    "IsExclusivePublic":false,
                    "ProjectStatus":5,
                    "Duration":95,
                    "Interest":8.60,
                    "MinInvestPartsCount":1,
                    "MaxInvestPartsCount":10,
                    "RemainPartsCount":0,
                    "EachPartAmount":1000.00,
                    "AppendBuyAmount":1000.00,
                    "RepayBegin":"2016-11-30 00:00:00",
                    "MaxLimitCount":20000.00,
                    "TotalMaxLimitCount":500000.00,
                    "ReFree":"13608040001",
                    "PartsCount":2000
                },
                "Status":1
            });

            //回款账户
            PayBankCardsDM.setValue({
                Status:1,       //绑卡状态 0：失败，1：成功，2：未绑卡
                PrjectType:1,        //0：普通项目，1：专属项目
                SelectIndex:3,      //默认选中的银行卡
                StayMobile:"186****2323",
                BankAccountList:[
                    {
                        "UserBankAccountId": "b8f6b16f482741258a12cca9dc529059",
                        "AccountNoHide": " **** **** **** 6610",
                        "AccountNoShortHide": "**** **** 6610",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cmbc",
                        "BankCardType": 0,
                        "BankCode": "305",
                        "BankIconCss": "bank-cmbc",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cmbc.png",
                        "BankName": "中国民生银行",
                        "Brdnbr": null,
                        "Type": "借记卡",
                        "SingleLimit": 10,
                        "DailyLimit": 100,
                        "Description": ""
                    },
                    {
                        "UserBankAccountId": "dd4a2bb44a9742b9bc839c35436e9279",
                        "AccountNoHide": " **** **** **** 2210",
                        "AccountNoShortHide": "**** **** 2210",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ecitic",
                        "BankCardType": 0,
                        "BankCode": "302",
                        "BankIconCss": "bank-ecitic",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ecitic.png",
                        "BankName": "中信银行",
                        "Brdnbr": null,
                        "Type": "借记卡",
                        "SingleLimit": 10,
                        "DailyLimit": 100,
                        "Description": ""
                    },
                    {
                        "UserBankAccountId": "5a2702e0a0084bbabd1f73070b9a0c1f",
                        "AccountNoHide": " **** **** **** 3310",
                        "AccountNoShortHide": "**** **** 3310",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cebbank",
                        "BankCardType": 0,
                        "BankCode": "303",
                        "BankIconCss": "bank-cebbank",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cebbank.png",
                        "BankName": "中国光大银行",
                        "Brdnbr": null,
                        "Type": "借记卡",
                        "SingleLimit": 10,
                        "DailyLimit": 100,
                        "Description": ""
                    },
                    {
                        "UserBankAccountId": "c170a4830f88470b9e5c3bdcc35512b8",
                        "AccountNoHide": " **** **** **** 9910",
                        "AccountNoShortHide": "**** **** 9910",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ccb",
                        "BankCardType": 0,
                        "BankCode": "105",
                        "BankIconCss": "bank-ccb",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ccb.png",
                        "BankName": "中国建设银行",
                        "Brdnbr": null,
                        "Type": "借记卡",
                        "SingleLimit": 10,
                        "DailyLimit": 100,
                        "Description": ""
                    }
                ]
            });
            //身份信息
            userInfoDM.setValue({
                realName:"林**"
            });
            //银行卡列表
            BankCardListDM.setValue({
                BankCardId: "",
                BankCardList: [
                    {
                        "BankName": "浙商银行",
                        "BankCode": "316",
                        "BankLogo": "bank-zheshang",
                        "Brdnbr": "316331000018",
                        "SingleLimit": "50",
                        "DailyLimit": "无限制",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国工商银行",
                        "BankCode": "102",
                        "BankLogo": "bank-icbc",
                        "Brdnbr": "102100004951",
                        "SingleLimit": "5",
                        "DailyLimit": "5",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国农业银行",
                        "BankCode": "103",
                        "BankLogo": "bank-abc",
                        "Brdnbr": "203100000027",
                        "SingleLimit": "0.2",
                        "DailyLimit": "1",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国银行",
                        "BankCode": "104",
                        "BankLogo": "bank-boc",
                        "Brdnbr": "104100000045",
                        "SingleLimit": "5",
                        "DailyLimit": "50",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国建设银行",
                        "BankCode": "105",
                        "BankLogo": "bank-ccb",
                        "Brdnbr": "105100000017",
                        "SingleLimit": "5",
                        "DailyLimit": "5",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "交通银行",
                        "BankCode": "301",
                        "BankLogo": "bank-comm",
                        "Brdnbr": "301290011110",
                        "SingleLimit": "1(不含1)",
                        "DailyLimit": "1(不含1)",
                        "Type": "储蓄卡",
                        "Description": "柜面、网银开通无卡支付业务"
                    },
                    {
                        "BankName": "中国光大银行",
                        "BankCode": "303",
                        "BankLogo": "bank-cebbank",
                        "Brdnbr": "303100000006",
                        "SingleLimit": "20",
                        "DailyLimit": "50",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中信银行",
                        "BankCode": "302",
                        "BankLogo": "bank-ecitic",
                        "Brdnbr": "302100011106",
                        "SingleLimit": "0.5（需开通认证支付）",
                        "DailyLimit": "1",
                        "Type": "储蓄卡",
                        "Description": "柜面、网银或在线开通无卡支付业务"
                    },
                    {
                        "BankName": "上海浦东发展银行",
                        "BankCode": "310",
                        "BankLogo": "bank-spdb",
                        "Brdnbr": "310290000013",
                        "SingleLimit": "5",
                        "DailyLimit": "5",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "兴业银行",
                        "BankCode": "309",
                        "BankLogo": "bank-cib",
                        "Brdnbr": "309391000011",
                        "SingleLimit": "5",
                        "DailyLimit": "50",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "上海银行",
                        "BankCode": "401",
                        "BankLogo": "bank-shbc",
                        "Brdnbr": "313290000017",
                        "SingleLimit": "50",
                        "DailyLimit": "无限制",
                        "Type": "储蓄卡",
                        "Description": "柜台开通在线支付（并预留手机号）"
                    },
                    {
                        "BankName": "北京银行",
                        "BankCode": "403",
                        "BankLogo": "bank-bankofbeijing",
                        "Brdnbr": "313100000659",
                        "SingleLimit": "50",
                        "DailyLimit": "无限制",
                        "Type": "储蓄卡",
                        "Description": "柜面、电话银行、网银方式办理“在线支付签约”开通无卡支付功能"
                    },
                    {
                        "BankName": "平安银行",
                        "BankCode": "307",
                        "BankLogo": "bank-pingan",
                        "Brdnbr": "307584008005",
                        "SingleLimit": "10",
                        "DailyLimit": "100",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国民生银行",
                        "BankCode": "305",
                        "BankLogo": "bank-cmbc",
                        "Brdnbr": "305100000013",
                        "SingleLimit": "50",
                        "DailyLimit": "50",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "广发银行",
                        "BankCode": "306",
                        "BankLogo": "bank-cgbchina",
                        "Brdnbr": "306581000003",
                        "SingleLimit": "50",
                        "DailyLimit": "无限制",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "招商银行",
                        "BankCode": "308",
                        "BankLogo": "bank-cmb",
                        "Brdnbr": "308584001024",
                        "SingleLimit": "100",
                        "DailyLimit": "100",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "中国邮政储蓄银行",
                        "BankCode": "100",
                        "BankLogo": "bank-psbc",
                        "Brdnbr": "403100000004",
                        "SingleLimit": "10",
                        "DailyLimit": "50",
                        "Type": "储蓄卡",
                        "Description": ""
                    },
                    {
                        "BankName": "华夏银行",
                        "BankCode": "304",
                        "BankLogo": "",
                        "Brdnbr": "304100040000",
                        "SingleLimit": null,
                        "DailyLimit": null,
                        "Type": "储蓄卡",
                        "Description": null
                    },
                    {
                        "BankName": "广州农村商业银行",
                        "BankCode": "1405",
                        "BankLogo": "",
                        "Brdnbr": "314581000011",
                        "SingleLimit": null,
                        "DailyLimit": null,
                        "Type": "储蓄卡",
                        "Description": null
                    },
                    {
                        "BankName": "网关测试银行",
                        "BankCode": "700",
                        "BankLogo": "bank-test",
                        "Brdnbr": "316331000018",
                        "SingleLimit": null,
                        "DailyLimit": null,
                        "Type": "储蓄卡",
                        "Description": null
                    }
                ]
            })

            URLDM.setValue({
                agreement:{
                    name:"绵阳市商业银行平台服务协议（个人版）",
                    link:"../RightTransferProtocol/index.html"
                }
            })
        };

        UEventHub.on("pageLoad",function(){
            ajaxFn();
            ReFreeDM.setValue("123465547967")
        });
        var PageDM = {
            URL:URLDM,
            inputNum:inputNumDM,
            PayBankCards:PayBankCardsDM,
            userInfo:userInfoDM,
            ExclusiveNum:ExclusiveNumDM,
            BussinessPwd:BussinessPwdDM,
            ReFree:ReFreeDM,
            checkbox:checkboxDM,
            btn:btnDM,
            resultDate:resultDateDM,
            BankCardList:BankCardListDM,
            payType:payTypeDM,
            days:daysDM,
            gatewayResult:gatewayResultDM,
            gatewayLayer:gatewayLayerDM
        };
    </script>
<script type="text/javascript" src="../ConfirmPay\index.js"></script></body>
</html>